<?php
/*
UserCp Created By Alan S
Designed For SMF 1.1 +
UserCP V 1.4 14/December/2007
*/

 function template_main()

{

	global $scripturl, $webmaster_email, $txt, $context, $settings, $ID_MEMBER, $modSettings;


if ($context['user']['is_logged'] && $context['allow_edit_profile'] && $modSettings['usercp_enable'])
echo '
<table border="0" width="100%" id="table1" cellspacing="1" style="border-collapse: collapse">

<!-- Start off with the welcome text -->

<center>' , $txt['usercp_welcome'] , '<b>', $context['user']['name'] , '</b><br></center>

<!-- Now , onto the first row of icons -->

<tr>

<!-- Account Info Image -->

<td align="center" width="25%" valign="top">
<a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=account"><img border="0" src="',$settings['images_url'],'/usercp/ksysguard.png" width="80" height="80" ></a></td>

<!-- Look and Layout Image -->

<td align="center" width="25%" valign="top">
<a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=theme"><img border="0" src="',$settings['images_url'],'/usercp/kivio.png" width="80" height="80"></a></td>

<!-- Theme Option Image -->

<td align="center" width="25%" valign="top">
<a href="', $scripturl, '?action=theme;sa=pick;u=', $ID_MEMBER, ';sesc=', $context['session_id'], '"><img border="0" src="',$settings['images_url'],'/usercp/blockdevice.png" width="80" height="80"></a></td>

<!-- My Profile Image -->

<td align="center" width="25%" valign="top">
<a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=forumProfile"><img border="0" src="',$settings['images_url'],'/usercp/kuser.png" width="80" height="80" ></a></td>
</tr>

<!-- end the first row of icons -->
<!-- Start the first row of text -->
<tr>

<!-- Account Info Text -->

<td align="center" width="25%" valign="top">
<font face="Verdana" size="2"><a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=account"><b>',$txt['usercp_account_info'],'</a><br>
</b></font><font face="Verdana" size="1">',$txt['usercp_account_info_summary'],'</font></td>

<!-- Look And Layout Text -->

<td align="center" width="25%" valign="top">
<font face="Verdana" size="2"><a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=theme"><b>',$txt['usercp_look_and_layout'],'</a><br>
</b></font><font face="Verdana" size="1">',$txt['usercp_look_and_layout_summary'],'</font></td>

<!-- Theme Option Text -->

<td align="center" width="25%" valign="top">
<font face="Verdana" size="2"> <a href="', $scripturl, '?action=theme;sa=pick;u=', $ID_MEMBER, ';sesc=', $context['session_id'], '"><b>',$txt['usercp_my_theme'],'</a><br>
</b></font><font face="Verdana" size="1">',$txt['usercp_my_theme_summary'],'</font></td>

<!-- My Profile Text -->

<td align="center" width="25%" valign="top">
<font face="Verdana" size="2"><a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=forumProfile"><b>',$txt['usercp_my_profile'],'</a><br>
</b></font><font face="Verdana" size="1">',$txt['usercp_my_profile_summary'],'</font></td>
</tr>
<!-- end the first row of text -->
<!-- Onto the second row of icons! -->
<tr>

<!-- My Stats Image -->

<td align="center" width="25%" valign="top">
<a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=statPanel"><img border="0" src="',$settings['images_url'],'/usercp/kwalletmanager.png" width="80" height="80"></a></td>

<!-- My Posts Image -->

<td align="center" width="25%" valign="top">
<a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=showPosts"><img border="0" src="',$settings['images_url'],'/usercp/kedit.png" width="80" height="80"></a></td>

<!-- My Notifications Image -->

<td align="center" width="25%" valign="top">
<a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=notification"><img border="0" src="',$settings['images_url'],'/usercp/mailreminder.png" width="80" height="80"></a></td>

<!-- My Buddies Image -->

<td align="center" width="25%" valign="top">
<a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=editBuddies"><img border="0" src="',$settings['images_url'],'/usercp/kdmconfig.png" width="80" height="80"></a></td>
</tr>

<!--  end the second row of images -->
<!-- Start the second row of text! -->
<tr>

<!-- My Stats Text -->

<td align="center" width="25%" valign="top">
<font face="Verdana" size="2"><a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=statPanel"><b>',$txt['usercp_my_stats'],'</a><br>
</b></font><font face="Verdana" size="1">',$txt['usercp_my_stats_summary'],'</font></td>

<!-- My Posts Text -->

<td align="center" width="25%" valign="top">
<font face="Verdana" size="2"><a href="', $scripturl,'?action=profile;u=', $ID_MEMBER, ';sa=showPosts"><b>',$txt['usercp_my_posts'],'</a><br>
</b></font><font face="Verdana" size="1">',$txt['usercp_my_posts_summary'],'</font></td>

<!-- My Notifications Text -->

<td align="center" width="25%" valign="top">
<font face="Verdana" size="2"><a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=notification"><b>',$txt['usercp_my_notifications'],'</a><br>
</b></font><font face="Verdana" size="1">',$txt['usercp_my_notifications_summary'],'</font></td>

<!-- My Buddies Text -->

<td align="center" width="25%" valign="top">
<font face="Verdana" size="2"><a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=editBuddies"><b>',$txt['usercp_buddies'] ,'</a><br>
</b></font><font face="Verdana" size="1">',$txt['usercp_buddies_summary'],'</font></td>
</tr>

<!-- end the second row of text -->
<!-- start the third row of images! -->
<tr>

<!-- Message Options Image -->

<td align="center" width="25%" valign="top">
<a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=pmprefs"><img border="0" src="',$settings['images_url'],'/usercp/mail.png" width="80" height="80"></a></td>

<!-- Search Image -->

<td align="center" width="25%" valign="top">
<a href="', $scripturl, '?action=search"><img border="0" src="',$settings['images_url'],'/usercp/find.png" width="80" height="80"></a></td>

<!-- Contact Admin Image -->';
// If its set to use pm instead of email use this code
if ($modSettings['usercp_usepm'] && $modSettings['usercp_enablecontactadmin'] && $context['user']['is_logged'] && $context['allow_edit_profile'] && $modSettings['usercp_enable'])
echo '
<td align="center" width="25%" valign="top">
<a href="' ,$scripturl, '?action=pm;sa=send;u=' ,$modSettings['usercp_adminid'], '"><img border="0" src="',$settings['images_url'],'/usercp/agent.png" width="80" height="80"></a></td>';
//if they dont want to use pm's , use this code
if (!$modSettings['usercp_usepm'] && $modSettings['usercp_enablecontactadmin'] && $context['user']['is_logged'] && $context['allow_edit_profile'] && $modSettings['usercp_enable'])
echo '
<td align="center" width="25%" valign="top">
<a href="mailto:', $webmaster_email ,'"><img border="0" src="',$settings['images_url'],'/usercp/agent.png" width="80" height="80"></a></td>';

// Resume code as normal

if ($context['user']['is_logged'] && $context['allow_edit_profile'] && $modSettings['usercp_enable'])
echo '
<!-- Delete Account Image -->

<td align="center" width="25%" valign="top">
<a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=deleteAccount"><img border="0" src="',$settings['images_url'],'/usercp/delete.png" width="80" height="80"></a></td>
</tr>

<!-- end third row of images -->
<!-- start third row of text -->
<tr>

<!-- Message Options Text -->

<td align="center" width="25%" valign="top">
<font face="Verdana" size="2"><a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=pmprefs"><b>',$txt['usercp_message_options'],'</a><br>
</b></font><font face="Verdana" size="1">',$txt['usercp_message_options_summary'],'</font></td>

<!-- Search Text -->

<td align="center" width="25%" valign="top">
<font face="Verdana" size="2"><a href="', $scripturl, '?action=search"><b>',$txt['usercp_search'],'</a><br>
</b></font><font face="Verdana" size="1">',$txt['usercp_search_summary'],'</font></td>

<!-- Contact Admin Text -->';
// Use this code if they want to use pms
if ($modSettings['usercp_usepm'] && $modSettings['usercp_enablecontactadmin'] && $context['user']['is_logged'] && $context['allow_edit_profile'] && $modSettings['usercp_enable'])
echo '
<td align="center" width="25%" valign="top">
<font face="Verdana" size="2"><a href="' ,$scripturl, '?action=pm;sa=send;u=' ,$modSettings['usercp_adminid'], '"><b>',$txt['usercp_contact_admin'],'</a><br>
</b></font><font face="Verdana" size="1">',$txt['usercp_contact_admin_summary'],'</font></td>';
//use this code if they dont want to use pms
if (!$modSettings['usercp_usepm'] && $modSettings['usercp_enablecontactadmin'] && $context['user']['is_logged'] && $context['allow_edit_profile'] && $modSettings['usercp_enable'])
echo '
<td align="center" width="25%" valign="top">
<font face="Verdana" size="2"><a href="mailto:' ,$webmaster_email, '"><b>',$txt['usercp_contact_admin'],'</a><br>
</b></font><font face="Verdana" size="1">',$txt['usercp_contact_admin_summary'],'</font></td>';

// Resume code as normal

if ($context['user']['is_logged'] && $context['allow_edit_profile'] && $modSettings['usercp_enable'])
echo '
<!-- Delete Account Text -->
<td align="center" width="25%" valign="top">
<font face="Verdana" size="2"><a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=deleteAccount"><b>',$txt['usercp_delete_account'],'</a><br>
</b></font><font face="Verdana" size="1">',$txt['usercp_delete_account_summary'],'</font></td>
</tr>


<!-- end third row of images  -->

<! -- start fourth row of images -->';
// Custom UserCP Field Image 1
if($modSettings['usercp_field1enable'] && $modSettings['usercp_enable'])
echo '
<tr><td align="center" width="25%" valign="top">
<a href="', $modSettings['usercp_field1url'],'"><img border="0" src="',$modSettings['usercp_field1image'],'" width="80" height="80"></a></td>';
// Custom UserCP Field Image 2
if($modSettings['usercp_field2enable'] && $modSettings['usercp_enable'])
echo '
<td align="center" width="25%" valign="top">
<a href="', $modSettings['usercp_field2url'],'"><img border="0" src="',$modSettings['usercp_field2image'],'" width="80" height="80"></a></td>';
// Custom UserCP Field Image 3
if($modSettings['usercp_field3enable'] && $modSettings['usercp_enable'])
echo '
<td align="center" width="25%" valign="top">
<a href="', $modSettings['usercp_field3url'],'"><img border="0" src="',$modSettings['usercp_field3image'],'" width="80" height="80"></a></td> ';
// Custom UserCP Field Image 4
if($modSettings['usercp_field4enable'] && $modSettings['usercp_enable'])
echo '
<td align="center" width="25%" valign="top">
<a href="', $modSettings['usercp_field4url'],'"><img border="0" src="',$modSettings['usercp_field4image'],'" width="80" height="80"></a></td></tr>';
// end 4th row of images
// Start 4th Row Of Text
echo '
<tr>
<td align="center" width="25%" valign="top">';
//Custom UserCP Field 1 Text
if($modSettings['usercp_field1enable'] && $modSettings['usercp_enable'])
echo '
<font face="Verdana" size="2"><a href="', $modSettings['usercp_field1url'],'"><b>',$modSettings['usercp_field1maintext'],'</a><br>
</b></font><font face="Verdana" size="1">',$modSettings['usercp_field1summary'],'</font></td>';
// Custom UserCP Field 2 Text
if($modSettings['usercp_field2enable'] && $modSettings['usercp_enable'])
echo '
<td align="center" width="25%" valign="top">
<font face="Verdana" size="2"><a href="', $modSettings['usercp_field2url'],'"><b>',$modSettings['usercp_field2maintext'],'</a><br>
</b></font><font face="Verdana" size="1">',$modSettings['usercp_field2summary'],'</font></td>';
// Custom UserCP Field 3 Text
if($modSettings['usercp_field3enable'] && $modSettings['usercp_enable'])
echo '
<td align="center" width="25%" valign="top">
<font face="Verdana" size="2"><a href="', $modSettings['usercp_field3url'],'"><b>',$modSettings['usercp_field3maintext'],'</a><br>
</b></font><font face="Verdana" size="1">',$modSettings['usercp_field3summary'],'</font></td>';
 // Custom UserCP Field 4 Text
 if($modSettings['usercp_field4enable'] && $modSettings['usercp_enable'])
echo '
<td align="center" width="25%" valign="top">
<font face="Verdana" size="2"><a href="', $modSettings['usercp_field4url'],'"><b>',$modSettings['usercp_field4maintext'],'</a><br>
</b></font><font face="Verdana" size="1">',$modSettings['usercp_field4summary'],'</font></td></tr>';

if ($context['user']['is_logged'] && $context['allow_edit_profile'] && $modSettings['usercp_enable'])
echo '
</table>
<br>';
//If switch view option is enabled , Show it
if ($modSettings['usercp_switchview'] && $modSettings['usercp_enable'])
echo '
 <center><font size="2pt"><a href="' ,$scripturl, '?action=profile;u=' ,$ID_MEMBER, '">Switch To Standard Profile View</a></font></center><br></br>';
// If Show Admin ID is enabled & the user is a admin
if ($context['user']['is_admin'] && $modSettings['usercp_enable'])
echo '
<center><font size="1pt">Your Member ID is ' ,$ID_MEMBER, '</font></center>';
// Show the copyright here if the usercp is enabled , we will show it somewhere else if its disabled.
if ($modSettings['usercp_enable'])
 echo '
 <center><font size="1pt"><a href="mailto:alanscomputergenius@gmail.com">',$txt['usercp_copyright'],'</a></font></center>';

// But what about guests? Heres the error they'll see

      if ($context['user']['is_guest'])
      echo '
     <center> <table border="0" width="100%" class="tborder" cellspacing="' , ($context['browser']['is_ie'] || $context['browser']['is_opera6']) ? '1' : '0' , '" cellpadding="4" style="margin-bottom: 2ex;">
		<tr>
			<td class="catbg">' ,$txt['usercp_error'], '</td>
   </tr>
   <tr>
			<td valign="middle" align="center" height="60"> <b>',$txt['usercp_guest'],' <a href="',$scripturl,'?action=login">',$txt['usercp_login'],'</a> ',$txt['usercp_or'],' <a href="',$scripturl,'?action=register">',$txt['usercp_register'],'</a></b> </td>
  </td>
  </tr>
    </center>';

 // And how about if the UserCp is disabled?
 
 if(!$modSettings['usercp_enable'])
 echo '
 
 <center> <table border="0" width="100%" class="tborder" cellspacing="' , ($context['browser']['is_ie'] || $context['browser']['is_opera6']) ? '1' : '0' , '" cellpadding="4" style="margin-bottom: 2ex;">
		<tr>
			<td class="catbg">' ,$txt['usercp_disabled'], '</td>
   </tr>
   <tr>
			<td valign="middle" align="center" height="60"> <b>' ,$txt['usercp_disabled'], ' , ' ,$txt['usercp_clickhere'], ' <a href="' ,$scripturl, '?action=profile;u=', $ID_MEMBER, '">' ,$txt['usercp_profile'],'</b> </td>
   
  </td>
  </tr>
  <tr>
  <td align="center">' ,$txt['usercp_copyright'], '</td>
  </tr>
    </center>';

}

?>

